using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class AccessDataSourceParameterPage : System.Web.UI.Page
{
    GridView gridView;
    
    protected void Page_Load(object sender, EventArgs e)
    {
        
        gridView = new GridView();
        this.form1.Controls.Add(gridView);
        ShowCustomers("USA");
    }

    void ShowCustomers(string countryName)
    {

        AccessDataSource acessDataSource;
        acessDataSource = new AccessDataSource();
        acessDataSource.DataFile =
        Server.MapPath(".") + "\\Northwind.mdb";
        acessDataSource.SelectCommandType =
        SqlDataSourceCommandType.Text;
        acessDataSource.SelectCommand =
        "select CustomerID,CompanyName, " +
        "ContactName,Address,City from Customers " +
        " where Country=@CountryName ";
        acessDataSource.SelectParameters.Add(
        "CountryName", TypeCode.String, countryName);
        gridView.DataSource = acessDataSource;
        gridView.DataBind();

    }
}
